#include<bits/stdc++.h>
using namespace std;
const int MAXN=,MAXL=;
int n,cnt,len,lena;
char a[MAXL],temp[MAXL];
struct point
{
	int fail,c[26],count;
}p[MAXL*26];
void insert()
{
	int u=0;
	p[0].fail=0;
	for(int i=0;i<len;++i)
	{
		int k=temp[i]-'a';
		if(!p[u].c[k])p[u].c[k]=++cnt;
		u=p[u].c[k];
		if(i==len-1)++p[u].count;
	}
	return;
}
void cal_fail()
{
	queue<int>q;
	q.push(0);
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		for(int i=0;i<26;++i)
		{
			if(!p[u].c[i])continue;
			int k=p[u].fail;
			while(k&&!p[k].c[i])k=p[k].fail;
			if(u!=k)p[p[u].c[i]].fail=p[k].c[i];
			q.push(p[u].c[i]);
		}
	}
	return;
}
int query()
{
	int i=0,j=0,ans=0;
	while(i<lena)
	{
		int k=a[i]-'a';
		while(j&&!p[j].c[k])j=p[j].fail;
		j=p[j].c[k];
		int temp=j;
		while(temp)
		{
			ans+=p[temp].count;
			temp=p[temp].fail;
		}
		++i;
	}
	return ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",temp);
		len=strlen(temp);
		insert();
	}
	scanf("%s",a);
	lena=strlen(a);
	cal_fail();
	printf("%d\n",query());
	return 0;
}
